#define  _CRT_SECURE_NO_WARNINGS	1
#include <stdio.h>
#include <string.h>
#include <assert.h>
//#include <limits.h>
//size_t my_strlen(char arr[])
//{
//	size_t count = 0;
//	while (*arr)
//	{
//		count++;
//		arr++;
//	}
//	return count;
//}
//char* my_strcpy(char* des, const char* str)
//{
//	char* p = des;
//	assert(des && str);
//	while (*des++ = *str++)
//	{
//		;
//	}
//	return p;
//}
//char* my_strcat(char* str2, const char* str1)
//{
//	char* p = str2;
//	while (*str2)
//		str2++;
//	while (*str2++ = *str1++)
//	{
//		;
//	}
//	return p;
//}
void* my_memmove(void* des, void* str, size_t num)
{
	void* p = des;
	const void* s1 = des;
	const void* s2 = str;
	if (des < str)
	{
		while (num--)
		{
			*(char*)des = *(char*)str;
			des = (char*)des + 1;
			str = (char*)str + 1;
		}
	}
	else
	{
		while (num--)
		{
			des = s1;
			str = s2;
			str = (char*)str + num;
			des = (char*)des + num;
			*(char*)des = *(char*)str;
		}
	}
	return p;
}
int main()
{
	///*int arr1[] = { 1,2,3,5,6 };
	//int arr2[] = { 1,2,3,4 };
	//printf("%d\n", memcmp(arr1, arr2, 3 * sizeof(int)));
	//printf("%d\n", memcmp(arr1, arr2, 13));*/
	///*float a = 4 / 3;
	//printf("%f\n", a);*/
	///*char arr1[] = "abcde";
	//char arr2[] = "abcf";
	//printf("%d\n", memcmp(arr1, arr2, 4 * sizeof(char)));*/
	///*char arr[] = "abcd";
	////printf("%zd\n", my_strlen(arr));*/4
	///*char arr[] = "abcdef";
	//char arr1[30] = {0};
	//printf("%s\n", my_strcpy(arr1, arr));*/
	//	
	/*char arr1[] = "xxxx";
	char arr2[30] = "abc";
	printf("%s\n", my_strcat(arr2, arr1));*/
	int arr[] = {1,2,3,4,5,6,7,8,9};
	int sz = sizeof(arr) / sizeof(arr[0]);
	int i = 0;
	my_memmove(arr + 2, arr, 4 * sizeof(int));
	for (i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}
